package com.k2091.washcar.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.k2091.washcar.entity.FormInline;
import com.k2091.washcar.entity.Users;
import com.k2091.washcar.entity.UsersCar;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author author
 * @since 2021-06-01
 */
public interface UsersMapper extends BaseMapper<Users> {

    /**
     * 用户可查自己的车辆信息
     * @param id
     * @return
     */
    @Select("select * from users_car where userId=#{id}")
    List<UsersCar> selectByUserId(Long id);

    List<Users> selectUser(FormInline formInline);

    @Select("select * from users where id=#{id}")
    Users selectById(Long id);

    boolean addUsers(Users users);

    @Update("update users set status=#{status} where id=#{id}")
    int upStatus(@Param("id")Long id,@Param("status")int status);

    int upUsers(Users users);

    int upUser(Users users);
}
